<?php

namespace backend\models;

use Yii;

class Major extends \common\models\Major
{
    public function getMajorCourses(){
        return parent::getMajorCourses()->orderBy('PKXQXH');
    }

    //提供关联数组 ZYDM => ZYMC ，可用于下拉框
    public static function getMajorID($school_id=null){
        $query=self::find()->select(['ZYMC'])->orderBy('ID')->indexBy('ID');
        if($school_id){
            $query->andWhere(['XXID'=>$school_id]);
        }
        return $query->column();
    }
}